<!-- // *** ebowden2, jamatz: 02-26-2007: Added this log and search system test.  It should automatically go to a page in a new browser window, log it, search for it, and then delete it and verify the deletion. -->
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>ECMAUnit Tests</title>
    <script language="JavaScript" type="text/javascript" src="chrome://mylog/content/mylog.js"></script>
    <script language="JavaScript" type="text/javascript" src="chrome://mylog/content/mylog-datastorage.js"></script>
    <script language="JavaScript" type="text/javascript" src="chrome://mylog/content/mylogsidebar.js"></script>
    <script type="text/javascript" src="chrome://mylog/content/test/ecmaunit.js"> </script>
    <script language="JavaScript" type="text/javascript" src="chrome://mylog/content/mylog-utility.js"></script>
    <script type="text/javascript">
//<![CDATA[
var testWindow;
var dataStore;
var dataHandler;

        function TestLogAndSearch() {
            this.name = 'TestLogAndSearch';
            
            this.setUp = function() {
            	dataStore = new XmlDataStore();
				dataHandler = dataStore.open();
            };
            
            this.testLogAndSearch1 = function() {
				testWindow = window.open("http://www.google.com/search?q=hello");
				setTimeout("continueTest1();", 3000);
            };

			
			this.tearDown = function() {
            	dataStore.close(dataHandler);
            };
        };
        TestLogAndSearch.prototype = new TestCase;

        function runTests() {
            placeholder = document.getElementById('placeholder');
            var testsuite = new TestSuite(new HTMLReporter(placeholder));
            testsuite.registerTest(TestLogAndSearch);
            testsuite.runSuite();
        }
        
        function continueTest1() {        	
			handleLogContentSubmission(testWindow.location, testWindow.document.title, new Array('google', 'whatever'), "I don't know why you say goodbye; I say hello! uniqueTestID01", testWindow.document);
			var searchResults = search("uniqueTestID01", false, false, true);
			assertTrue(searchResults != null);
			assertEquals(searchResults.length, 1);
			alert(searchResults[0].getId());
			dataHandler.removeEntry(searchResults[0].getId());
			searchResults = search("uniqueTestID01", false, false, true);
			assertTrue(searchResults != null);
			assertEquals(searchResults.length, 0);*/
			alert("about to close:");
			testWindow.close();
		}
//]]>
</script>
</head>

<body onload="runTests()">
<h3>EcmaUnit tests for MyLog Search And Log System Tests</h3>
<div id="placeholder"> </div>
</body>
</html>
